from permutations import combinations

def isSolution(a,b,c,d,e):
    sum = 10 + a + b
    
    ax = 10    
    bx = sum - b - c
    cx = sum - c - d
    dx = sum - d - e
    ex = sum - e - a
    
    if set([a,b,c,d,e,ax,bx,cx,dx,ex]) == set(range(1, 11)):
        print [(ax,a,b),(bx,b,c),(cx,c,d),(dx,d,e),(ex,e,a)]

digits = range(1, 10)
for (a,b,c,d,e) in combinations(digits, 5):
    isSolution(a,b,c,d,e)
    

    
